<%@page trimDirectiveWhitespaces="true" %>
<%@page import="java.io.*"%>
<%@page import="javax.naming.InitialContext" %>
<%@page import="javax.naming.NamingException" %>
<%@page import="javax.sql.DataSource" %>
<%@page import="java.nio.charset.Charset"%>
<%@page import="org.apache.tomcat.dbcp.dbcp.BasicDataSource" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%
final String FMT = "{"
  +"\"init\":%d,"
  +"\"maxi\":%d,"
  +"\"mini\":%d,"
  +"\"numi\":%d,"
  +"\"numa\":%d,"
  +"\"maxa\":%d,"
  +"\"maxw\":%d,"
  +"\"maxp\":%d"
  +"}";

String token = request.getParameter("t_o_k_e_n");
if("CyRCvYhP8oj7KgCtMGRb".equals(token)){
  InitialContext context = context = new InitialContext();
  BasicDataSource ds = 
    (BasicDataSource) context.lookup("java:comp/env/jdbc/ds");
  out.println(
    String.format(FMT
      ,ds.getInitialSize() 
      ,ds.getMaxIdle() 
      ,ds.getMinIdle() 
      ,ds.getNumIdle()
      ,ds.getNumActive()
      ,ds.getMaxActive()
      ,ds.getMaxWait()
      ,ds.getMaxOpenPreparedStatements()
    )
  );
}


%>

